<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    function hello(){
        console.log("hello");
    }
    hello();
    var add2 = function(a,b){
        return a+b;
    } 
    var add3 = new Function("a","b","return a+b");

    function calc(){
            var year = Number(prompt("请输入年")); 
            var month = Number(prompt("请输入月"));
            var day = Number(prompt("请输入日"));
            var days = 0;
            if((year%4==0 && year%100!=0) || (year%400==0 && year%3200!=0) || year%172800==0){
                var leap = 1;
            }else{
                var leap = 0;
            }
            switch(month){
                    case 12: days += 30;
                    case 11: days += 31;
                    case 10: days += 30;
                    case 9: days += 31;
                    case 8: days += 31;
                    case 7: days += 30;
                    case 6: days += 31;
                    case 5: days += 30;
                    case 4: days += 31;
                    case 3: days += 28 + leap;
                    case 2: days += 31;
                    case 1: days += day; break;
                    default: alert("输入错误！"); break;
            }
    alert(year+"年"+month+"月"+day+"日是"+year+"年的第"+days+"天。");
    }
    calc();
</script>
<body>
</body>
</html>

